{% extends "swarming/base.html" %}


{% block headers %}
<script src="/third_party/webcomponentsjs/webcomponents.min.js"></script>
<link rel="import" href="/elements/stats-overview-build.html">
<style>
  .admin a {
    {% if not is_admin %}
      color: gray;
      text-decoration: line-through;
    {% endif %}
  }
  .command {
    font-family: monospace;
    margin-bottom: 10px;
    margin-top: 10px;
    white-space: pre-wrap;
  }
  .privileged_user a {
    {% if not is_privileged_user %}
      color: gray;
      text-decoration: line-through;
    {% endif %}
  }
  .user a {
    {% if not is_user %}
      color: gray;
      text-decoration: line-through;
    {% endif %}
  }
  stats-overview {
    min-width: 600px;
  }
</style>
{% endblock %}


{% block body %}

<h1>Swarming Server</h1>
<div layout horizontal>
  <div>
    <div>Swarming Server is an open source task distribution service written in python
    running on AppEngine.</div>
    <p>

    {% if not nickname %}
    Please <a href="{{signin_link|safe}}">sign in</a> for more access.
    {% else %}
    As a {{user_type}}, you are entitled to see these pages:
    {% endif %}

    <h3>Service Status</h3>
    <ul>
      <li><a href="/stats">Usage statistics</a></li>
      <li class="user"><a href="/user/tasks">Tasks list and search</a></li>
      <li class="privileged_user"><a href="/restricted/bots">Known bots</a></li>
      <li class="admin"><a href="/restricted/ereporter2/errors">Recent ereporter2 errors</a></li>
      <li class="admin"><a href="/restricted/ereporter2/report">Recent exceptions in server log</a></li>
    </ul>

    <h3>Configuration</h3>
    <ul class="admin">
      <li><a href="/restricted/config">Global server config</a></li>
      <li><a href="/restricted/upload/bootstrap">Upload new bootstrap.py</a></li>
      <li><a href="/restricted/upload/bot_config">Upload new bot_config.py</a></li>
      <li><a href="/auth/groups">Manage user groups</a></li>
    </ul>

    <h3>Running a bot</h3>
      To bootstrap a bot, run one of these:
      <ol>
        <li>
          TL;DR;
<div class="command">python -c "import urllib; exec urllib.urlopen('{{host_url}}/bootstrap').read()"</div>
        </li>
        <li>
          Escaped version to pass as a ssh argument:
<div class="command">'python -c "import urllib; exec urllib.urlopen('"'{{host_url}}/bootstrap'"').read()"'</div>
        </li>
        <li>
          Manually. Don't forget if swarming_bot.zip was already present, curl
          won't overwrite it so "rm swarming_bot.zip" first if necessary.
<div class="command" style="margin-bottom:0">mkdir bot; cd bot
curl -sSLOJ {{host_url}}/bot_code
python swarming_bot.zip</div>
        </li>
      </ol>
    </li>
    See the project's page for code and help pages:
      <a href="https://code.google.com/p/swarming/">
        https://code.google.com/p/swarming/</a>

    <h3>Map reduce jobs</h3>
    <ul class="admin">
      <li><a href="/restricted/mapreduce/status">Map reduce jobs status</a></li>
      {% for job in mapreduce_jobs %}
        <li>
          <form action="/restricted/launch_mapreduce" method="post">
            <input type="hidden" name="xsrf_token" value="{{xsrf_token}}" />
            <input type="hidden" name="job_id" value="{{job.id}}" />
            <button type="submit">Launch '{{job.name}}'</button>
          </form>
        </li>
      {% endfor %}
    </ul>
  </div>
  <stats-overview flex></stats-overview>
</div>

{% endblock %}
